#ifndef POSIPANNEL_H
#define POSIPANNEL_H

#include <QWidget>
#include <QMap>
#include <QString>
#include <QTableWidget>
#include <QHeaderView>
#include <QEvent>
#include <QAbstractItemView>
#include <QDebug>


class PosiPannel : public QTableWidget{

    Q_OBJECT
public:
    PosiPannel(int rowNum, int colNum, int model, QWidget* parent=nullptr);
    void setSelectableCell(QStringList cells);
    void setSelectCell(QStringList cells);
    void setNormCell(QStringList cells);

    void setSelectColor(QColor color);

    void setNormMode(bool mode);

    QStringList getSelectList();

private:
    void updateColor();
    bool eventFilter(QObject*, QEvent*) override;


signals:
    void    sigSelectChanged(QStringList);
private slots:
    void    onCellClicked(int row, int col);        // 单选时触发
    void    onSelectRangeChanged();                 // 多选模式时触发

private:
    int     _rowNum;
    int     _colNum;
    int     _model;         // 0: 单选模式  1: 多选模式
    bool    _normMode = false;

    QStringList _selectableList;
    QStringList _normList;
    QStringList _selectList;

    QColor  _selectColor = QColor("#A3B1FF");

};

#endif // POSIPANNEL_H
